#include<stdio.h>
#include<stdlib.h>
struct Node{
    int data;          //数据域
    struct Node*next;  //指针域
};
struct Node* createlist()
{
    struct Node* headNode=(struct Node*)malloc(sizeof(struct Node));
    //headNode成为了结构体变量
    //变量使用前必须被初始化
    //headNode->data=1;
    headNode->next=NULL;
    return headNode;
}
//创建节点
struct Node* createNode(int data)
{
    struct Node* newNode=(struct Node*)malloc(sizeof(struct Node));
    newNode->data=data;
    newNode->next=NULL;
    return newNode;
}
//插入节点
void insertNodeByHead(struct Node* headNode,int data)
{
    //1创建插入的节点
    struct Node* newNode=createNode(data);
    newNode->next=headNode->next;
    headNode->next=newNode;
}
//打印链表
void printfList(struct Node*headNode)
{
    struct Node*Pmove=headNode->next;
    while(Pmove)
    {
        printf("%d",Pmove->data);
        Pmove=Pmove->next;
    }
}
//删除节点
void deleteNodeByAppoin(struct Node* headNode,int posData)
{
    struct Node* posNode=headNode->next;
    struct Node* posNodeFront=headNode;
    if(posNode=NULL)
    printf("无法删除，链表为空\n");
    else{
        while(posNode->data!=posData)  //不等于指定数据
        {
            posNodeFront=posNode;
            posNode=posNodeFront->next;
            if(posNode=NULL)
            {
                printf("没有找到相关信息，无法删除\n");
                break; 
            }
        }
    }
    
}


